//学生年级
let grades = [
    {label: '小学一年级', value: '小学一年级', key: '0'},
    {label: '小学二年级', value: '小学二年级', key: '1'},
    {label: '小学三年级', value: '小学三年级', key: '2'},
    {label: '小学四年级', value: '小学四年级', key: '3'},
    {label: '小学五年级', value: '小学五年级', key: '4'},
    {label: '小学六年级', value: '小学六年级', key: '5'},
    {label: '初中一年级', value: '初中一年级', key: '6'},
    {label: '初中二年级', value: '初中二年级', key: '7'},
    {label: '初中三年级', value: '初中三年级', key: '8'},
    {label: '高中一年级', value: '高中一年级', key: '9'},
    {label: '高中二年级', value: '高中二年级', key: '10'},
    {label: '高中三年级', value: '高中三年级', key: '11'},
    {label: '其他', value: '其他', key: '12'}
];

//科目
let subjects = [
    {name: "语文", checked: false},
    {name: "数学", checked: false},
    {name: "英语", checked: false},
    {name: "物理", checked: false},
    {name: "化学", checked: false},
    {name: "历史", checked: false},
    {name: "道法（政治）", checked: false},
    {name: "生物", checked: false},
    {name: "地理", checked: false},
    {name: "其他", checked: false},
];

let sexList = [{
    label: '男',
    value: '男',
    key: 0,
}, {
    label: '女',
    value: '女',
    key: 1,
}];

let courseType = [{
    label: '文科',
    value: '文科',
    key: 0,
}, {
    label: '理科',
    value: '理科',
    key: 1,
}];

let regionList = [{
    label: '福田区',
    value: '福田区'
}, {
    label: '罗湖区',
    value: '罗湖区'
}, {
    label: '南山区',
    value: '南山区'
}, {
    label: '宝安区',
    value: '宝安区'
}, {
    label: '龙岗区',
    value: '龙岗区'
}, {
    label: '龙华区',
    value: '龙华区'
}, {
    label: '坪山区',
    value: '坪山区'
}, {
    label: '光明区',
    value: '光明区'
}, {
    label: '大鹏新区',
    value: '大鹏新区'
}, {
    label: '未知区域',
    value: '未知区域'
},];

/*
* 省份
* */
let provinces = [{label: '北京市', value: '北京市'},
    {label: '天津市', value: '天津市'},
    {label: '河北省', value: '河北省'},
    {label: '山西省', value: '山西省'},
    {label: '内蒙古自治区', value: '内蒙古自治区'},
    {label: '辽宁省', value: '辽宁省'},
    {label: '吉林省', value: '吉林省'},
    {label: '黑龙江省', value: '黑龙江省'},
    {label: '上海市', value: '上海市'},
    {label: '江苏省', value: '江苏省'},
    {label: '浙江省', value: '浙江省'},
    {label: '安徽省', value: '安徽省'},
    {label: '福建省', value: '福建省'},
    {label: '江西省', value: '江西省'},
    {label: '山东省', value: '山东省'},
    {label: '河南省', value: '河南省'},
    {label: '湖北省', value: '湖北省'},
    {label: '湖南省', value: '湖南省'},
    {label: '广东省', value: '广东省'},
    {label: '广西壮族自治区', value: '广西壮族自治区'},
    {label: '海南省', value: '海南省'},
    {label: '重庆市', value: '重庆市'},
    {label: '四川省', value: '四川省'},
    {label: '贵州省', value: '贵州省'},
    {label: '云南省', value: '云南省'},
    {label: '西藏自治区', value: '西藏自治区'},
    {label: '陕西省', value: '陕西省'},
    {label: '甘肃省', value: '甘肃省'},
    {label: '青海省', value: '青海省'},
    {label: '宁夏回族自治区', value: '宁夏回族自治区'},
    {label: '新疆维吾尔自治区', value: '新疆维吾尔自治区'},
    {label: '新疆兵团', value: '新疆兵团'}];

//接口请求相关的常量
const R = {
    success: '000000',
    fail: '888168',
    error: '999999',
    data: 'responseData',
    code: 'code',
    msg: 'message',
    getData: function (res) {
        return res[this.data];
    },
    isSuccess: function (res) {
        if (!!res) {
            return res[this.code] === this.success;
        } else {
            return false;
        }
    }
};

/**
 * 啥也不做的函数
 * @constructor
 */
const VOID = () => {
    void (0)
};

//角色相关
const ROLE = {
    P: 'PARENT',
    T: 'TUTOR'
};

//接口前缀
const API_PREFIX = "/nginx";

//订单状态
const ORDER_STATUSES = {
    "EDITING": "编辑中",
    "AUDITING": "审核中",
    "PUBLISH": "正被接单",
    "APPLIED": "请选家教",
    "REJECTED": "审核不通过",
    "FULL": "请选家教",
    "SELECTED": "已选择家教",
    "PAYED": "请与家教联系",
    "TRIAL": "试讲",
    "TEACHING": "教学中",
    "NO_DEAL": "未成交",
    "UNSATISFACTORY": "不满意",
    "FINISHED": "已完成",
    "APPLY_REFUND": "申请退费",
    "REJECT_REFUND": "驳回退费申请",
    "AGREE_REFUND": "退费中",
    "FINISHED_REFUNDED": "已退费",
    "DISABLED": "已失效"
};

const RESUME_STATUSES = {
    EDITING: "编辑中",

    /*不可修改数据*/
    AUDITING: "审核中",

    /*可修改数据*/
    REJECTED: "已驳回",

    /*可修改数据，修改后数据状态修改为“编辑中”*/
    NORMAL: "审核通过",

    /*作废的数据，不可见、不可修改*/
    DELETE: "已删除"
};

//刷新页面的默认函数名
const FLUSH = "doFlush";

// 构建自定义信息窗体
let createInfoWindow = (title, content, mapInstance) => {
    var info = document.createElement("div");
    info.className = "custom-info input-card content-window-card";

    // 定义顶部标题
    var top = document.createElement("div");
    var titleD = document.createElement("div");
    var closeX = document.createElement("img");
    top.className = "info-top";
    titleD.innerHTML = title;
    closeX.src = "https://webapi.amap.com/images/close2.gif";

    // 关闭信息窗体
    closeX.onclick = function () {
        mapInstance.clearInfoWindow();
    }

    top.appendChild(titleD);
    top.appendChild(closeX);
    info.appendChild(top);

    // 定义中部内容
    var middle = document.createElement("div");
    middle.className = "info-middle";
    middle.style.backgroundColor = '#fff';
    middle.innerHTML = content;
    info.appendChild(middle);


    // 定义底部内容
    var bottom = document.createElement("div");
    bottom.className = "info-bottom";
    bottom.style.position = 'relative';
    bottom.style.top = '0px';
    bottom.style.margin = '0 auto';
    var sharp = document.createElement("img");
    sharp.src = "https://webapi.amap.com/images/sharp.png";
    bottom.appendChild(sharp);
    info.appendChild(bottom);
    return info;
}

// 周的 picker 数据
let weekList = [
    {label: '周一', value: '周一', key: '1'},
    {label: '周二', value: '周二', key: '2'},
    {label: '周三', value: '周三', key: '3'},
    {label: '周四', value: '周四', key: '4'},
    {label: '周五', value: '周五', key: '5'},
    {label: '周六', value: '周六', key: '6'},
    {label: '周日', value: '周日', key: '7'},
];

/*上传图片大小限制 6M*/
const MAX_LENGTH_PHOTO = 2097152 * 3;

module.exports = {
    sexList, // 性别
    courseType, // 课程类型
    regionList, // 详细地址
    R, //状态码
    ROLE,
    API_PREFIX,
    ORDER_STATUSES,
    grades,
    subjects,
    createInfoWindow, // 构建自定义信息窗体
    weekList,
    provinces,
    RESUME_STATUSES,
    MAX_LENGTH_PHOTO
};